//
//  WYFollowCell.m
//  Boss
//
//  Created by admin on 2018/7/2.
//  Copyright © 2018年 admin. All rights reserved.
//

#import "WYFollowCell.h"
@interface WYFollowCell()

@property (strong, nonatomic) IBOutlet UIImageView *userImageView;
@property (strong, nonatomic) IBOutlet UILabel *userLabel;
@property (strong, nonatomic) IBOutlet UIButton *stateButton;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *btnWidth;

@property (strong, nonatomic) IBOutlet UIImageView *vipImageView;


@end
@implementation WYFollowCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.userImageView setCornerRadius:20.f];
    [self.stateButton setBorderWithWidth:kLineHeight andColor:kColorMainColor];
    [self.stateButton setCornerRadius:4.f];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}
-(void)setUserMessage:(WYUserMessage *)userMessage WithType:(NSString *)type
{
    if ([type isEqualToString:@"1"]) {
        
        self.userLabel.text = userMessage.userName;
        [self.userImageView sd_setImageWithURL:[NSURL URLWithString:userMessage.url] placeholderImage:[UIImage imageNamed:@"logo_place"]];
        [self.stateButton setTitle:@" 取消关注 " forState:(UIControlStateNormal)];
        [self.stateButton setTitleColor:kColorMainColor forState:(UIControlStateNormal)];
        [self.stateButton setBorderWithWidth:kLineHeight andColor:kColorMainColor];
        self.btnWidth.constant = 80;
    }else{
        
        self.userLabel.text = userMessage.userName;
        [self.userImageView sd_setImageWithURL:[NSURL URLWithString:userMessage.url] placeholderImage:[UIImage imageNamed:@"logo_place"]];
        
        if (userMessage.isLove.integerValue) {
            [self.stateButton setTitle:@" 已关注 " forState:(UIControlStateNormal)];
            [self.stateButton setTitleColor:kColor999999 forState:(UIControlStateNormal)];
            [self.stateButton setBorderWithWidth:kLineHeight andColor:kColor999999];
        }else{
            [self.stateButton setTitle:@" 关注 " forState:(UIControlStateNormal)];
            [self.stateButton setBorderWithWidth:kLineHeight andColor:kColorMainColor];
            [self.stateButton setTitleColor:kColorMainColor forState:(UIControlStateNormal)];
//            [self.stateButton setImage:[UIImage imageNamed:@"me_follow_icon"] forState:UIControlStateNormal];
        }
        
       
        
    }
     [self.vipImageView showVipImageViewStatusWithVipId:userMessage.vipId];
    
    
    
    
}
- (IBAction)clickStateBtn:(id)sender {
    if ([self.delegate respondsToSelector:@selector(clickStateAction:)]) {
        [self.delegate clickStateAction:self];
    }
    
    
}




@end
